package Controller;

import java.io.PrintWriter;
import java.io.StringWriter;

import me.gacl.test.Test;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;





@Controller
public class ControllorLog4j {
	
	 
	 @RequestMapping("/logger.do")
	 @ResponseBody
	 public String toLog() {
     Logger logger=Logger.getLogger(ControllorLog4j.class);
     try {
         int a = 1/0;
     }catch (Exception e){
    	 StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
         e.printStackTrace(pw);
         logger.error("Main错误：" + sw.toString());
         logger.error("Every one must die");
     }
	
	 return "loger";
	 }
}
